package com.iflytek.hive.need5;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class QuatTop10Mapper extends Mapper<LongWritable, Text, QuatOrderBean, LongWritable> {
    private final QuatOrderBean keyOut = new QuatOrderBean();
    private final LongWritable outValue = new LongWritable(1);
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        // 将行文本数据切分
        String[] fields = value.toString().split(",");

        keyOut.set(fields[0].substring(0,4),fields[1],fields[2],Double.valueOf(fields[3]));
        context.write(keyOut, outValue);
    }

}
